package com.yisu.auction.api.web.controller;

import com.yisu.auction.api.core.service.IJPushService;
import com.yisu.auction.api.domain.request.BasePage;
import com.yisu.auction.api.web.interceptor.IAuthVerifyAnnotation;
import com.yisu.auction.ewf.common.enums.LoginTypeEnum;
import com.yisu.auction.ewf.common.enums.ResponseCode;
import com.yisu.auction.ewf.common.web.JsonResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * author: 赵杰
 * Business Description：极光推送业务
 * createTime：2017/9/13
 */
@Controller
@RequestMapping(value = "/jPush")
public class JPushController {
    @Resource
    private IJPushService ijPushService;

    /**
     * author: 赵杰
     * Business Description：定时推送
     *
     * @param
     * @return 系统参数
     */
    @RequestMapping(value = "/timingPush", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json; charset=utf-8")
    @ResponseBody
    @IAuthVerifyAnnotation(Desc = "登录验证", LoginTypeEnum = LoginTypeEnum.NO_NEED_LOGIN)
    public JsonResult timingPush() {
        if (ijPushService.timingPush()) {
            return new JsonResult(ResponseCode.FAILURE.code, "操作成功");
        }
        return new JsonResult(ResponseCode.SUCCESS.code, "操作失败");
    }
}
